package com.example.demo.vo

import com.example.demo.dbmodels.TDevice
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty


@ApiModel(description = "设备信息")
class DeviceVo {

    @ApiModelProperty(name = "id", value = "id")
    var id: Int? = -1

    @ApiModelProperty(name = "dept_code", value = "科室编号")
    var dept_code: String? = ""

    @ApiModelProperty(value = "科室名称")
    var dept_name: String? = ""

    @ApiModelProperty(name = "device_no", value = "设备号")
    var device_no: String? = ""

    @ApiModelProperty(name = "device_mac", value = "设备mac地址")
    var device_mac: String? = ""

    @ApiModelProperty(name = "bed_name", value = "床位名称")
    var bed_name: String? = ""

    @ApiModelProperty(name = "bed_code", value = "床位编号")
    var bed_code: String? = ""

    @ApiModelProperty(name = "device_ip", value = "设备ip地址")
    var device_ip: String? = ""

    @ApiModelProperty(name = "device_type", value = "设备类型 0:床头卡 1:护理看板 2:移动PDA")
    var device_type: Int? = -1

    @ApiModelProperty(name = "register_state", value = "绑定的状态 0:未绑定 1:绑定中")
    var register_state: Int? = -1

    @ApiModelProperty(name = "app_version", value = "设备当前app版本号")
    var app_version: String? =null

    @ApiModelProperty(name = "nurseboard_ip", value = "护理看板ip地址")
    var nurseboard_ip: String? = ""

    @ApiModelProperty(name = "connect_start", value = "在线状态")
    var connect_start: Int? = null

    fun getVo(table: TDevice): DeviceVo {
        table.let {
            val data = DeviceVo()
            data.id = it.id
            data.dept_code = it.dept_code
            data.dept_name = it.dept_name
            data.device_no = it.device_no
            data.device_mac = it.device_mac
            data.bed_name = it.bed_name
            data.bed_code = it.bed_code
            data.device_ip = it.device_ip
            data.device_type = it.device_type
            data.connect_start = it.connect_start
            data.register_state = it.register_state
            data.app_version = it.app_version
            data.nurseboard_ip = it.nurseboard_ip
            return data
        }
    }

    fun getListVo(table: List<TDevice>): List<DeviceVo> {
        table.let {
            val listData = mutableListOf<DeviceVo>()
            it.forEach {
                val data = DeviceVo()
                data.id = it.id
                data.bed_name = it.bed_name
                data.dept_code = it.dept_code
                data.dept_name = it.dept_name
                data.bed_code = it.bed_code
                data.device_no = it.device_no
                data.device_mac = it.device_mac
                data.device_ip = it.device_ip
                data.device_type = it.device_type
                data.connect_start = it.connect_start
                data.register_state = it.register_state
                data.app_version = it.app_version
                data.nurseboard_ip = it.nurseboard_ip
                listData.add(data)
            }
            return listData
        }
    }


}
